#ifndef __ARRAYLIST_H__
#define __ARRAYLIST_H__

#include "lib_config.h"
#include <stddef.h>

#define LIB_ARRAYLIST_DEFAULT	12

/**
it is the same array	as	java ArrayList
**/
typedef struct lib_s_ArrayList
{
	size_t st_length;	//	ArrayList size, not change it yourself. It is private
	size_t	st_mallocSize;
	size_t	st_index;	//	remaining of arrayList
	void**	v_items;	//	all	item to store,	not change it yourself. It is private
	size_t	(*size)();	//	size of	ArrayList
	lib_t_boolean	(*hasNext)(const struct lib_s_ArrayList*	arrayList);	//	if hav next item
	void	(*moveToFirst)(struct lib_s_ArrayList*	arrayList);	//	move to first
	void*	(*getNext)(struct lib_s_ArrayList*	arrayList);	//	get next item
	lib_t_boolean	(*removeItem)(struct lib_s_ArrayList*	arrayList);	//	remove this item
	void*	(*get)(const	struct lib_s_ArrayList*	arrayList,	size_t	position);	//	get position of item. If wrong, return NULL
	lib_t_boolean	(*remove)(struct lib_s_ArrayList*	arrayList,	size_t	position);	//	remove	position of item
	void	(*clear)(struct lib_s_ArrayList*	arrayList);	//	clear all item
	lib_t_boolean	(*add)(struct lib_s_ArrayList*	arrayList,	void*	item);	//	add item
	lib_t_boolean (*addItem)(struct lib_s_ArrayList*	arrayList,	void*	item,	size_t	position);	//	add position of item
}lib_s_ArrayList;

/**
*
*init	ArrayList
*
* @param size size of ArrayList
*	the size of ArrayList
**/
lib_s_ArrayList*	lib_ArrayList_init(size_t	size);
#endif
